<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <%@ include file="/commons/basejs.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>企业管理</title>
    <script src="../../../static/easyui/plugins/datagrid.show.js" type="text/javascript"></script>
</head>
<body>
    <div class="easyui-layout" fit="true" >
        <!--west企业列表start-->
        <div data-options="region:'west',split:true,border:false" title="企业列表" style="width:50%;">
            <table id="company_datagrid" class="easyui-datagrid"
                   data-options="
		   		url:'${path}/company/companydg.do',
		   		fit:true,
		   		rownumbers:true,
		   		fitColumns: true,
		   		toolbar:'#company_tools',
		   		pagination:true,
		   		singleSelect:true,
		   		onClickRow:function(index, row){
		   			rowchange(row.id);
		   		}">
                <thead>
                <th data-options="field:'id'">ID</th>
                <th data-options="field:'name',width:100">企业名称</th>
                <th data-options="field:'logo',width:50,formatter:formatterImg">logo</th>
                <th data-options="field:'type',width:50,formatter:
            function(value){if(value==1) return '私企';
            if(value==2)return '国企';
            return '事业'}">类型</th>
                <th data-options="field:'provinc'" hidden>省</th>
                <th data-options="field:'city'" hidden>市</th>
                <th data-options="field:'districk'" hidden>区</th>
                <th data-options="field:'telephone',width:50">座机</th>
                <th data-options="field:'url',width:60">网址</th>
                <th data-options="field:'address',width:80">地址</th>
                <th data-options="field:'linkman',width:30">联系人</th>
                <th data-options="field:'email',width:30">邮箱</th>
                <th data-options="field:'phone',width:30">联系电话</th>
                <th data-options="field:'userId'" hidden>关联用户</th>
                </thead>
            </table>
            <div id="company_tools">
                <shiro:hasPermission name="/company/add.do">
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="openEditBox('add')">添加</a>
                </shiro:hasPermission>
                <shiro:hasPermission name="/company/edit.do">
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="openEditBox('edit')">编辑</a>
                </shiro:hasPermission>
                <shiro:hasPermission name="/company/del.do">
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="deleteCompany()">删除</a>
                </shiro:hasPermission>
                <select id="settleType" style="width:80px;height:24px;position: relative;top: 3px;border-radius: 3px;" onchange="comboxchange()">
                    <option value="">企业类型</option>
                    <option value="1">私企</option>
                    <option value="2">国企</option>
                    <option value="3">事业</option>
                </select>
                <input id="searchCompany" class="easyui-searchbox" data-options="prompt:'请输入企业名称',searcher:searchName" style="width:220px;"/>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="refCompany()">刷新</a>
            </div>
        </div>

        <div data-options="region:'east',split:true,border:false" title="部门列表" style="width:13%;">
            <table id="dept_datagrid" class="easyui-datagrid"
                   data-options="
                        url:'${path}/company/deptdg.do',
                        toolbar:'#dept_tools',
                        fit:true,
                        rownumbers:true,
                        fitColumns: true,
                        singleSelect:true,
                        onBeforeEdit: edit2,
                        onAfterEdit: edit1,
                        onCancelEdit:edit1,
                        onClickRow:function(index, row){
                        rowchange2(row.id);}">
                <thead>
                <th data-options="field:'id'" >ID</th>
                <th data-options="field:'name',width:100,editor:{type:'text'}">部门名称</th>
                </thead>
            </table>
            <div id="dept_tools">
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="addRow()">添加</a>
                <a href="#" id="editdeptbtn" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick="editDept()">编辑</a>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-del'" onclick="delDept()">删除</a>
            </div>
        </div>

        <!--center员工 start-->
        <div data-options="region:'center',split:true,border:false" title="员工列表" style="width:42%;">
            <table id="Employ_datagrid" class="easyui-datagrid"
                   data-options="
		   		url:'${path}/company/employeedg.do',
		   		fit:true,
		   		rownumbers:true,
		   		fitColumns: true,
		   		toolbar:'#employ_tools',
		   		pagination:true,
		   		singleSelect:true">
                <thead>
                <th data-options="field:'id'">ID</th>
                <th data-options="field:'companyId'" hidden>企业ID</th>
                <th data-options="field:'name',width:50">姓名</th>
                <th data-options="field:'sex',width:20,formatter:
            function(value){if(value) return '女';return '男';}">性别</th>
                <th data-options="field:'phone',width:50">电话</th>
                <th data-options="field:'card',width:70">身份证号</th>
                <th data-options="field:'email',width:70">邮箱</th>
                <th data-options="field:'deptId'" hidden>部门ID</th>
                <th data-options="field:'deptname',width:40" >部门</th>
                </thead>
            </table>
            <div id="employ_tools">
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="openUserBox('add')">添加</a>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick="openUserBox('edit')">修改</a>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-del'" onclick="deleteEmp()">删除</a>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="openUploadEmpanyeeBox()">批量添加</a>
                <select id="settleSex" style="width:80px;height:24px;position: relative;top: 3px;border-radius: 3px;" onchange="comboxsex()">
                    <option value="">性别</option>
                    <option value="0">男</option>
                    <option value="1">女</option>
                </select>
                <input id="searchEmployname" class="easyui-searchbox" data-options="prompt:'请输入员工姓名',searcher:searchEmploy" style="width:180px;"/>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="refcardEmployee()">重置</a>
            </div>
        </div>
    </div>
<jsp:include page="addOreidtCompany.jsp"></jsp:include>
</body>
</html>
